package com.mew.chess.core.game.lh.game.common;

import lombok.ToString;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

@ToString
public enum LhBetType {
    HE(0),
    LONG(1),
    HU(2);



    private final int code;

    LhBetType(final int code) {
        this.code = code;
    }

    private final static Map<Integer, LhBetType> stateMap
            = Arrays.stream(LhBetType.values()).collect(Collectors.toMap(LhBetType::code, code -> code));

    public int code() {
        return this.code;
    }

    public static LhBetType parse(int code) {
        return stateMap.getOrDefault(code, LhBetType.LONG);
    }


}
